<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> -->

    <!-- 路径可能跟我不一样，需要修改 -->
    <script src="../js/vue.global.js"></script>

</head>

<body>

    <div id="app">

        请输入数字1: <input type="text" v-model="num1"> <br>
        请输入数字2: <input type="text" v-model="num2"> <br>

        <div>合计: {{sum}}</div>

    </div>


    <script>


        Vue.createApp({
            data() {
                return {
                    num1: 1,
                    num2: 1
                }
            },

            computed: {
                //定义一个计算属性,将经常用到的 计算过程定义一个函数
                sum() {
                    return parseInt(this.num1) + parseInt(this.num2)
                }
            }


        }).mount("#app")

    </script>




</body>

</html>